package top.ffhome.concurrency.example.singleton;

import top.ffhome.common.annotation.ThreadSafe;

/**
 * 懒汉模式 -- 双重同步锁单例模式,volatile防止指令重排
 */
@ThreadSafe
public class SingletonExample6 {
    private SingletonExample6() {
    }

    private static volatile SingletonExample6 instance = null;

    static {
        instance = new SingletonExample6();
    }

    public static SingletonExample6 getInstance() {
        return instance;
    }
}
